<?
 App::import('Helper', 'Number'); 
if(!isset($teams))
	$teams = $this->requestAction( array( 'controller' => 'pages', 'action' => 'iblessstats' ) );
$number = new NumberHelper();
$this->set('number',$number);

?>
			
			<div class="contentSide">
				<div class="counterBox">
				<span class="num" style="letter-spacing:17px">
				<?
					$num_str='000000'.$teams['totalibless'];
					echo substr($num_str, -6);
				?>
				</span>				
				</div>
				<a href="<?=$this->webroot.'ibless/add'?>" class="btnIbless btnFix"></a>
				<a href="<?=$this->webroot.'buzzup/add'?>" class="btnShortpost btnFix"></a>
				<div class="newFeed">
					<h3><?=$settings['WEEK_TITLE']?></h3>
					<? echo $settings['WEEK_GOALS'];?>
				
				</div>
				<div class="tweetsBox">
				<?=$settings['TWITTER']?>
				</div>
		


				<div class="statistic">
					<h3>iBless Statistic</h3>
					<span class="colorBgBrown colorBg">Team abbreviation</span>
					<span class="colorBgBlue colorBg">Total number of members signed up</span>
					<span class="colorBgGreen colorBg">Number of blessings to date</span>
					<span class="colorBgPink colorBg">Number of blessings / Total members x 12</span>
					<table cellpadding="0" cellspacing="0" border="0">
						<tr>
							<th class="brownBg" width="22%">Team</th>
							<th class="blueBg" width="28%">Signed up members</th>
							<th class="greenBg" width="28%">No. of blessings</th>
							<th class="pinkBg" width="18%">%</th>
						</tr>
						<?foreach($teams as $team):?>
						<?if(isset($team['Team']['name'])):?>
						<tr>
							<td class="grayBg"><?=$team['Team']['name']?></td>
							<td><?=$team['Team']['member_count']?></td>
							<td><?=$team['Team']['ibless_count']?></td>
							<td><?=$number->format($team['Team']['percentage']*100, array('places' => 0,
																		'before'=>''
																		))?>
							</td>
						</tr>
						<?endif;?>
						<?endforeach;?>
						
					</table>
				</div>
		
			
			</div>
			
